#ifndef MACROS_H
#define MACROS_H

/** Usefull macros definition. */
#define DEBUGS(...) 					\
	if (SERVER_DEBUG)					\
	{ 									\
		fprintf(stdout, __VA_ARGS__); 	\
		fprintf(stdout, "\n"); 			\
		fflush(stdout); 				\
	}

#define DEBUGC(...) 					\
	if (CLIENT_DEBUG) 					\
	{ 									\
		fprintf(stdout, __VA_ARGS__); 	\
		fprintf(stdout, "\n"); 			\
		fflush(stdout); 				\
	}

#define FILL_SOCKADDR_IN_INT(var_name, family, port, ip) 	\
	memset(&(var_name), 0, sizeof(struct sockaddr_in)); 	\
	(var_name).sin_family = (family); 						\
	(var_name).sin_port = htons(port); 						\
	(var_name).sin_addr.s_addr = htonl(ip)

#define FILL_SOCKADDR_IN_TXT(var_name, family, port, ip) 	\
	memset(&(var_name), 0, sizeof(struct sockaddr_in)); 	\
	(var_name).sin_family = (family); 						\
	(var_name).sin_port = htons(port); 						\
	inet_pton((family), (ip), &(var_name).sin_addr) 

#endif // !MACROS_H
